//
//  NavClearView.m
//  NavClearDemo
//
//  Created by LH-mac on 2019/5/30.
//  Copyright © 2019年 LH-mac. All rights reserved.
//

#import "NavClearView.h"
static NSString *CellID = @"CELLID";
@interface NavClearView ()<UITableViewDelegate,UITableViewDataSource>

@property (copy, nonnull) NSArray *dataArr;

@end

@implementation NavClearView

- (void)awakeFromNib{
    [super awakeFromNib];
    
    self.dataArr = @[@"1",@"2",@"3",@"4",@"5",@"1",@"2",@"3",@"4",@"5",@"1",@"2",@"3",@"4",@"5",@"1",@"2",@"3",@"4",@"5",@"1",@"2",@"3",@"4",@"5",@"1",@"2",@"3",@"4",@"5"];
    self.tb.delegate = self;
    self.tb.dataSource = self;
}

+ (instancetype)getInstanceNibName:(NSString*) identityNibName
{
    NSArray* nibView =  [[NSBundle mainBundle] loadNibNamed:identityNibName owner:nil options:nil];
    return [nibView lastObject];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArr.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
    }
    cell.textLabel.text = self.dataArr[indexPath.row];
    return cell;
}

#pragma mark - ScollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    CGFloat offset = scrollView.contentOffset.y;
  
    if ([self.delegate respondsToSelector:@selector(scrollToGetY:)]) {
        [self.delegate scrollToGetY:offset];
    }
    
}

@end
